﻿<%@ Page Title="" Language="C#" MasterPageFile="~/App_MasterPages/MainMasterPage.master"
    AutoEventWireup="true" CodeFile="Category.aspx.cs" Inherits="Admin_Category" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Main_HeaderContentPlaceHolder" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Main_MainContentPlaceHolder" runat="Server">
    <div id="background-blue2">
        background
    </div>
    <div class="page">
        <div class="page2">
            <div class="sidebar">
                <a href="../Default.aspx" id="logo">
                    <img id="Img1" runat="server" src="~/App_Themes/Default/images/logo.png" alt="logo" /></a>
                <ul>
                    <li class="home">
                        <a id="default_a" href="~/Admin/Confirm.aspx" runat="server">آزمایشات تایید شده</a></li>

                    <li class="selected about">
                        <a id="testlist_a" href="~/Admin/CategoryItem.aspx" runat="server">گروه آزمایشات</a></li>
                    <li class="projects"><a id="paper_a" runat="server">کاربری</a>
                        <ul>
                            <li><a href="~/Admin/User.aspx">کاربران</a></li>
                            <li><a href="~/Admin/ChangePassword.aspx">تغییر رمز عبور</a></li>
                        </ul>
                    </li>
                    <li class="blog">
                        <a id="gallery_a" runat="server">مدیریت سایت</a></li>

                    <li class="contact">
                        <a id="logout_a" href="#" runat="server" onclick="if(!confirm('آیا قصد خروج از سیستم را دارید؟')) return false;" onserverclick="LogoutButton_Click">خروج از سیستم</a></li>
                </ul>
            </div>
            <div class="body">
                <div>
                    <div>
                        <h3>گروه آزمایش ها</h3>
                    </div>
                    <div>
                        <table style="width: 100%" title="گروه آزمایش">
                            <tr>
                                <td style="width: 90px">عنوان گروه آزمایش:
                                </td>
                                <td style="width: 250px">
                                    <asp:TextBox ID="CategoryTitleTextBox" runat="server" Width="250px"></asp:TextBox>
                                </td>
                                <td style="width: 90px">سایز صفحه:
                                </td>
                                <td style="width: 100px">
                                    <asp:DropDownList ID="PageSizeDropDownList" runat="server" >
                                        <asp:ListItem Selected="True" Value="5">[پیش فرض]</asp:ListItem>
                                        <asp:ListItem Value="5">5 رکورد</asp:ListItem>
                                        <asp:ListItem Value="10">10 رکورد</asp:ListItem>
                                        <asp:ListItem Value="15">15 رکورد</asp:ListItem>
                                        <asp:ListItem Value="20">20 رکورد</asp:ListItem>
                                        <asp:ListItem Value="25">25 رکورد</asp:ListItem>
                                        <asp:ListItem Value="1000000">تمام رکورد ها</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                                <td style="width: 80px">
                                    <asp:ImageButton ID="SearchImageButton" runat="server" OnClick="SearchImageButton_Click"
                                        SkinID="SearchButton" />
                                    <asp:ImageButton ID="ClearImageButton" runat="server" OnClick="ClearImageButton_Click"
                                        OnClientClick="return false;" SkinID="ClearButton" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="5">
                                    <table>
                                        <tr>
                                            <td style="width: 353px;">
                                                <asp:GridView ID="CategoryGridView" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID"
                                                    DataSourceID="CategoryEntityDataSource" HorizontalAlign="Center" OnSelectedIndexChanged="CategoryGridView_SelectedIndexChanged"
                                                    PageSize="5" Width="300px" AllowSorting="True">
                                                    <Columns>
                                                        <asp:TemplateField>
                                                            <ItemTemplate>
                                                                <asp:ImageButton ID="SelectImageButton" runat="server" CommandName="Select" SkinID="SelectButton" />
                                                            </ItemTemplate>
                                                            <ItemStyle Width="25px" />
                                                        </asp:TemplateField>
                                                        <asp:BoundField DataField="CategoryID" Visible="False" />
                                                        <asp:BoundField DataField="CategoryTitle" HeaderText="عنوان گروه آزمایش" SortExpression="CategoryTitle">
                                                            <ItemStyle HorizontalAlign="Right" VerticalAlign="Middle" />
                                                        </asp:BoundField>
                                                    </Columns>
                                                </asp:GridView>
                                            </td>
                                            <td style="width: 20px"></td>
                                            <td valign="top" align="center">
                                                <asp:FormView ID="CategoryFormView" runat="server" DataSourceID="CategoryEntityDataSource"
                                                    DataKeyNames="CategoryID" DefaultMode="Insert" OnItemDeleted="CategoryFormView_ItemDeleted"
                                                    OnItemCommand="CategoryFormView_ItemCommand" Width="350px">
                                                    <EditItemTemplate>
                                                        <table border="0" cellpadding="0" cellspacing="0" style="width: 350px">
                                                            <tr valign="middle">
                                                                <td style="width: 100px" align="right">عنوان:
                                                                </td>
                                                                <td style="width: 250px" align="right">
                                                                    <asp:TextBox Font-Names="B Yekan" ID="TitleTextBox" runat="server" Text='<%# Bind("CategoryTitle") %>'
                                                                        MaxLength="500" Width="230px" />
                                                                    <asp:RequiredFieldValidator ID="TitleRequiredFieldValidator" runat="server" ControlToValidate="TitleTextBox"
                                                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                                                </td>
                                                            </tr>
                                                            <tr valign="middle">
                                                                <td style="width: 100px" align="right">توضیحات:
                                                                </td>
                                                                <td></td>
                                                            </tr>
                                                            <tr valign="middle">
                                                                <td colspan="2" align="left" dir="rtl">
                                                                    <asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>'
                                                                        TextMode="MultiLine" MaxLength="2500" Height="150px" Width="250px" />
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td colspan="2" align="left">
                                                                    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                                                                        <tr>
                                                                            <td style="height: 15px"></td>
                                                                            <td align="left" valign="top" style="width: 80px;"></td>
                                                                            <td align="left" valign="top" style="width: 80px;"></td>
                                                                            <td align="left" valign="top" style="width: 80px;"></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td style="height: 15px">&nbsp;
                                                                            </td>
                                                                            <td align="left" valign="top" style="width: 80px">
                                                                                <asp:ImageButton ID="DeleteImageButton" runat="server" CausesValidation="False" CommandName="Delete"
                                                                                    SkinID="DeleteButton" OnClientClick="if (!confirm('آيا از حذف مطمئن هستيد؟')) return false;" />
                                                                            </td>
                                                                            <td align="left" valign="top" style="width: 80px">
                                                                                <asp:ImageButton ID="UpdateImageButton" runat="server" CommandName="Update" SkinID="UpdateButton"
                                                                                    ValidationGroup="Update" OnClientClick="if (!confirm('آيا از اعمال تغییرات مطمئن هستيد؟')) return false;" />
                                                                            </td>
                                                                            <td align="left" valign="top" style="width: 80px">
                                                                                <asp:ImageButton ID="CancelImageButton" runat="server" CommandName="Cancel" SkinID="CancelButton" />
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </EditItemTemplate>
                                                    <InsertItemTemplate>
                                                        <table border="0" cellpadding="0" cellspacing="0" style="width: 350px">
                                                            <tr valign="middle">
                                                                <td style="width: 100px" align="right">عنوان:
                                                                </td>
                                                                <td style="width: 250px" align="right">
                                                                    <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("CategoryTitle") %>'
                                                                        MaxLength="500" Width="250px" />
                                                                    <asp:RequiredFieldValidator ID="TitleRequiredFieldValidator" runat="server" ControlToValidate="TitleTextBox"
                                                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                                                </td>
                                                            </tr>
                                                            <tr valign="middle">
                                                                <td style="width: 100px" align="right">توضیحات :
                                                                </td>
                                                                <td></td>
                                                            </tr>
                                                            <tr valign="middle">
                                                                <td colspan="2" align="left" dir="rtl">
                                                                    <asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>'
                                                                        TextMode="MultiLine" MaxLength="2500" Height="150px" Width="250px" />
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td colspan="2" align="left">
                                                                    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                                                                        <tr>
                                                                            <td style="height: 15px">&nbsp;
                                                                            </td>
                                                                            <td align="left" valign="top" style="width: 80px;"></td>
                                                                            <td align="left" valign="top" style="width: 80px;"></td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td style="height: 15px">&nbsp;
                                                                            </td>
                                                                            <td align="left" valign="top" style="width: 80px;">
                                                                                <asp:ImageButton ID="InsertButton" runat="server" CommandName="Insert" SkinID="InsertButton"
                                                                                    ValidationGroup="Insert" />
                                                                            </td>
                                                                            <td align="left" valign="top" style="width: 80px;">
                                                                                <asp:ImageButton ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                                                                    SkinID="CancelButton" />
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </InsertItemTemplate>
                                                </asp:FormView>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="footer">
                        <p>
                            &#169; 2023 Delta System Anahita
                        </p>
                        <ul>
                            <li><a id="A1" href="~/Guest/AboutUs.aspx" runat="server">تماس با ما</a> </li>
                            <li><a id="A2" href="~/Guest/Help.aspx" runat="server">راهنمای پذیرش</a> </li>
                            <li><a id="A3" href="~/Guest/Gallery.aspx" runat="server">گالری</a> </li>
                            <li><a id="A4" href="~/Guest/Paper.aspx" runat="server">مقالات</a> </li>
                            <li><a id="A5" href="~/Guest/TestList.aspx" runat="server">فهرست آزمایشات</a> </li>
                            <li><a id="A6" href="~/Default.aspx" runat="server">صفحه اصلی</a> </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <asp:EntityDataSource ID="CategoryEntityDataSource" runat="server" ConnectionString="name=DefaultEntityConnection"
        DefaultContainerName="DefaultEntityConnection" EntitySetName="Categories"
        Where="(@CategoryTitle is null || it.CategoryTitle LIKE '%' + @CategoryTitle + '%')"
        EnableUpdate="True"
        EnableDelete="True"
        EnableInsert="True"
        EnableFlattening="False"
        OnDeleted="CategoryEntityDataSource_Command"
        OnInserted="CategoryEntityDataSource_Command"
        OnUpdated="CategoryEntityDataSource_Command"
        AutoGenerateOrderByClause="True">
        <WhereParameters>
            <asp:ControlParameter ControlID="CategoryTitleTextBox" Name="CategoryTitle" Type="String" />
        </WhereParameters>
        <OrderByParameters>
            <asp:ControlParameter ControlID="CategoryGridView" Name="OrderBy" PropertyName="SortExpression"
                Type="String" />
        </OrderByParameters>
    </asp:EntityDataSource>
    <asp:HiddenField ID="CategoryIDHiddenField" runat="server" />
</asp:Content>
